package com.tjetc.view.impl;

import com.tjetc.pojo.dto.HotelDTO;
import com.tjetc.pojo.entity.Hotel;
import com.tjetc.utils.ScannerUtils;
import com.tjetc.view.HotelCRUDPage;

/**
 * @Author: itda
 * @Date: 2024/5/10 16:18
 * @Description: HotelCRUDPageImpl
 */
public class HotelCRUDPageImpl implements HotelCRUDPage {
    @Override
    public HotelDTO save() {
        System.out.println("请输入酒店名称:");
        String hotelName = ScannerUtils.sc.next();
        System.out.println("请输入酒店地址:");
        String hotelAddress = ScannerUtils.sc.next();
        System.out.println("请输入酒店所在的城市:");
        String hotelCity = ScannerUtils.sc.next();
        System.out.println("请输入酒店的描述:");
        String hotelDescription = ScannerUtils.sc.next();
        System.out.println("请输入酒店的电话:");
        String hotelPhone = ScannerUtils.sc.next();
        return HotelDTO.builder()
                .name(hotelName)
                .address(hotelAddress)
                .city(hotelCity)
                .description(hotelDescription)
                .phone(hotelPhone)
                .build();
    }

    @Override
    public Long delete() {
        System.out.println("请输入要删除酒店的id:");
        return ScannerUtils.sc.nextLong();
    }

    @Override
    public HotelDTO update() {
        System.out.println("请输入要修改的酒店id:");
        Long hotelId = ScannerUtils.sc.nextLong();
        System.out.println("请输入酒店名称:");
        String hotelName = ScannerUtils.sc.next();
        System.out.println("请输入酒店地址:");
        String hotelAddress = ScannerUtils.sc.next();
        System.out.println("请输入酒店所在的城市:");
        String hotelCity = ScannerUtils.sc.next();
        System.out.println("请输入酒店的描述:");
        String hotelDescription = ScannerUtils.sc.next();
        System.out.println("请输入酒店的电话:");
        String hotelPhone = ScannerUtils.sc.next();
        return HotelDTO.builder()
                .id(hotelId)
                .name(hotelName)
                .address(hotelAddress)
                .city(hotelCity)
                .description(hotelDescription)
                .phone(hotelPhone)
                .build();
    }
}
